
import java.io.IOException;
import javax.microedition.lcdui.game.Sprite;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author tien
 */
public class Bullet extends Moveable{
    public Bullet(GameScreen canvas, Sprite sprite, SpriteAnimationTask animator) throws IOException {
        super(canvas, sprite, animator);
    }
    
    void update() {
        this.controller.update();
    }
    
    void die() {
        super.die();
        this.canvas.removeBullet(this);
    }
    
    public boolean checkCollideAndSolve() {
        //Map
        boolean mapCollide =  canvas.getMap().checkCollide(sprite);

        boolean spidersCollide = false;
        try {
            spidersCollide = canvas.spidersCollideWithBullet(this);
        } catch (IOException ex) {
            ex.printStackTrace();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        
        boolean canMove = !(mapCollide || spidersCollide);
        return canMove;
    }
}
